Garsia-Wachs Algorithm